package com.didispace;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import feign.Headers;
import feign.Param;
import feign.RequestLine;

// 使用@FeignClient注解来指定这个接口所要调用的服务名称，接口中定义的各个函数使用Spring MVC的注解就可以来绑定服务提供方的REST接口，
// 比如下面就是绑定eureka-client服务的/dc接口的例子：
// 服务名不区分大小写，
@FeignClient("eureka-client")
public interface DcClient {
	@GetMapping("/dc")
    String consumer();
	
//	@PostMapping("/dc2")
//    String consumer(User user);
	
	@PostMapping(value="/Test")
    User consumer2(String u);
	

//	@PostMapping(value="/dc2")
//	String consumer(User user);
	
	@RequestMapping(value = "/get-dc", method = RequestMethod.GET)
	public String getDc(@RequestParam("id") String id, @RequestParam("userName") String userName);
	
	@RequestMapping(value = "/postDc", method = RequestMethod.POST)
	public String postDc(@RequestParam("id") String id, @RequestParam("userName") String userName);
	
	@PostMapping(value = "/postDc2")
	public String postDc2(@RequestBody User user, @RequestParam("id") String id, @RequestParam("userName") String userName);
	
	@GetMapping(value = "/feignTest")
	public User feignTest();
}
